<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Load php files
 *
 * @author QuangKhoi
 */
class Loader {

    //put your code here
    public function load() {
        require_once("Configuration.php");
        require_once("Database.php");
        require_once("DataTable.php");
        require_once("QueryResult.php");
        require_once("Model/Utils.php");
        require_once("Model/Status.php");
        require_once("View/".$GLOBALS["deviceType"]."/Master/MasterView.php");
        require_once("UserLoader.php");
        require_once("ErrorLoader.php");
        require_once("FolderLoader.php");

        FolderLoader::load();
        ErrorLoader::load();
        UserLoader::load();

        //Param parser
        #remove the directory path we don't want 
        $url = $_SERVER['REQUEST_URI'];
        $url = ltrim($url, '/');
        $request = $url;
        if (strpos($request, '?') != '') {
            $request = substr($request, 0, strpos($request, "?"));
        }
        #split the path by '/'
        $params = array($request);
        if (strpos($request, '/'))
            $params = split("/", $request);
        require_once("Model/Options.php");
        switch (strtoupper($params[0])) {
            case "USER":

                break;
            case "WS":
                require_once("Model/Moni.php");
            case "TEST":
            case "IRRELEVANT":
            case "M":
                //require_once("Libs/nusoap/nusoap.php");
                require_once("Libs/xmlsoap/soap_server.php");
                //require_once("Model/SOAP/bpServer.php");
                require_once("Model/SOAP/soapServer.php");
                //require_once("LibsLoader.php");
                require_once("MessageLoader.php");
                require_once("StreamLoader.php");
                require_once("FolderLoader.php");
                require_once("SignalLoader.php");
                require_once("ErrorLoader.php");
                require_once("TaskLoader.php");
                require_once("MetricsLoader.php");
                require_once("Model/Tag.php");
                require_once("Model/Twitter.php");
                require_once("Model/Facebook.php");
                require_once("Model/Google.php");
                require_once("Model/LinkedIn.php");
                require_once("Model/SentimentWords.php");
                require_once("Model/Sentiment.php");
                require_once("Model/SignalsHelper.php");
                require_once("Model/MessageAction.php");
                require_once("Model/SpamMessages.php");
                require_once("Model/Mail.php");
                require_once("Libs/php_serial.class.php");
                require_once("Model/SMS.php");
                require_once("Model/Comparison.php");
                require_once("Model/Group.php");
                //LibsLoader::load();
                MessageLoader::load();
                StreamLoader::load();
                FolderLoader::load();
                SignalLoader::load();
                ErrorLoader::load();
                TaskLoader::load();
                MetricsLoader::load();

                require_once("ZieLoader.php");
                ZieLoader::load();
                return;
                break;
            case "":
            case "HOME":
                require_once("FolderLoader.php");
                require_once("StreamLoader.php");
                FolderLoader::load();
                StreamLoader::load();
                break;
            case "SENTIMENT":
                require_once("Model/SOAP/bpServer.php");
            case "STREAM":
                require_once("FolderLoader.php");
                require_once("StreamLoader.php");
                //require_once("LibsLoader.php");
                require_once("Model/Tag.php");
                require_once("Model/Twitter.php");
                require_once("Model/Facebook.php");
                require_once("Model/Google.php");
                require_once("Model/LinkedIn.php");
                require_once("Model/SentimentWords.php");
                require_once("Model/Sentiment.php");
                require_once("SignalLoader.php");
                require_once("Model/SpamMessages.php");
                require_once("Model/Task.php");
                require_once("Model/TaskType.php");
                require_once("Model/Comparison.php");
                FolderLoader::load();
                StreamLoader::load();
                //LibsLoader::load();
                SignalLoader::load();
                require_once("ZieLoader.php");
                ZieLoader::load();
                break;
            case "ALERT":
                require_once("FolderLoader.php");
                FolderLoader::load();
                require_once("StreamLoader.php");
                StreamLoader::load();
                require_once("ZieLoader.php");
                ZieLoader::load();
                require_once("Model/SOAP/bpServer.php");
                require_once("Model/SignalsHelper.php");
                require_once("Model/Tag.php");
                require_once("Model/Comparison.php");
                break;
            case "ENGAGEMENT":
                require_once("Controller/".$GLOBALS["deviceType"]."/EngagementController.php");
            case "COMPARE":
                require_once("Controller/".$GLOBALS["deviceType"]."/CompareController.php");
            case "METRICS":
                require_once("FolderLoader.php");
                require_once("StreamLoader.php");
                require_once("MetricsLoader.php");
                require_once("Model/Tag.php");
                require_once("Libs/nusoap/nusoap.php");
                require_once("Model/Comparison.php");
                FolderLoader::load();
                StreamLoader::load();
                MetricsLoader::load();
                break;
            case "ACTIVITY":
                require_once("ZieLoader.php");
                ZieLoader::load();

                require_once("FolderLoader.php");
                require_once("StreamLoader.php");
                require_once("TaskLoader.php");
                require_once("SignalLoader.php");
                require_once("MessageLoader.php");
                require_once("Model/Twitter.php");
                require_once("Model/Facebook.php");
                require_once("Model/Google.php");
                require_once("Model/LinkedIn.php");
                require_once("Model/SentimentWords.php");
                require_once("Model/Sentiment.php");
                require_once("Model/Tag.php");
                SignalLoader::load();
                StreamLoader::load();
                FolderLoader::load();
                TaskLoader::load();

                MessageLoader::load();
                break;
            case "REPORT":

                break;
            case "AJAX":
                require_once("Model/TaskType.php");
                require_once("FolderLoader.php");
                FolderLoader::load();
                return;
                break;
            case "INFO":
            case "LOADSENTIMENTSTREAM":
            case "LOADSTREAM":
            case "NEWSTREAM":
                require_once("MessageLoader.php");
                require_once("FolderLoader.php");
                require_once("StreamLoader.php");
                //require_once("LibsLoader.php");
                require_once("Model/Tag.php");
                require_once("Model/Twitter.php");
                require_once("Model/Facebook.php");
                require_once("Model/Google.php");
                require_once("Model/LinkedIn.php");
                require_once("Model/SentimentWords.php");
                require_once("Model/Sentiment.php");
                require_once("Model/SOAP/bpServer.php");
                require_once("SignalLoader.php");
                require_once("Model/MessageAction.php");
                require_once("Model/SpamMessages.php");
                require_once("Model/Task.php");
                MessageLoader::load();
                FolderLoader::load();
                StreamLoader::load();
                //LibsLoader::load();
                SignalLoader::load();

                require_once("ZieLoader.php");
                ZieLoader::load();
                return;
            case "SETTINGS":
                require_once("FolderLoader.php");
                require_once("StreamLoader.php");
                FolderLoader::load();
                StreamLoader::load();
                break;
            case "TEST":
                require_once("Model/Facebook.php");
                require_once("Libs/nusoap/nusoap.php");
                require_once("Model/SOAP/bpServer.php");
                require_once("MetricsLoader.php");
                require_once("StreamLoader.php");
                require_once("Model/Sentiment.php");
                require_once("Model/SentimentWords.php");
                require_once("Model/Tag.php");
                //require_once("LibsLoader.php");
                MetricsLoader::load();
                StreamLoader::load();
                //LibsLoader::load();
                require_once("ZieLoader.php");
                ZieLoader::load();
                return;
            case "FOLDER":
                require_once("FolderLoader.php");
                require_once("StreamLoader.php");
                FolderLoader::load();
                StreamLoader::load();
                return;
            case "LOGOUT":
                break;
            case "AUTHORIZETWITTER":
                require_once("Model/Twitter.php");
                return;
            case "AUTHORIZEFACEBOOK":
                require_once("Model/Facebook.php");
                return;
            case "AUTHORIZEGOOGLE":
                require_once("Model/Google.php");
                return;
            case "AUTHORIZELINKEDIN":
                require_once("Model/LinkedIn.php");
                return;
            case "MAIL":
                //include("LibsLoader.php");
                require_once("FolderLoader.php");
                include("Model/Mail.php");
                include("Model/Stream.php");
                include("Model/Signal.php");
                //LibsLoader::load();
                FolderLoader::load();
                return;
            case "FBOBJECT":
            case "FBIMAGE":
                require_once("Model/Facebook.php");
                return;
            case "MONITORING":
                require_once("FolderLoader.php");
                require_once("StreamLoader.php");
                require_once("MoniLoader.php");
                StreamLoader::load();
                FolderLoader::load();
                MoniLoader::load();
                break;
            default:
                break;
        }
    }

}

?>
